/**
 * 
 */
package com.devmindset.jpatoolbox;

import org.springframework.util.StringUtils;



/**
 * Utility class. 
 * 
 * Composes different method and field conventional forms.
 * 
 * @author <a href="mailto:ice.penov@devmindset.com">Ice Penov</a>
 */
@SuppressWarnings("unchecked")
public final class Composer {
    
  private Composer() {
  }
    
  public static String composeAdder(Class theClass) {
    return composeMethod("add", theClass);
  }

  public static String composeRemover(Class theClass) {
    return composeMethod("remove", theClass);
  }

  public static String getFieldName(Class theClass) {
    return StringUtils.uncapitalize(theClass.getSimpleName());
  }
  
  public static String composeCollectionFieldName(Class theClass) {
  	return StringUtils.uncapitalize(theClass.getSimpleName()) + "s";
  }
  
  public static String composeGetter(Class theClass) {
    return composeMethod("get", theClass); 
  }
  
  public static String composeSetter(Class theClass) {
    return composeMethod("set", theClass);
  }
  
  private static String composeMethod(String prefix, Class theClass) {    
    return prefix + StringUtils.capitalize(theClass.getSimpleName());
  }
  
  
}
